/*
 * Copyright 2011 myTDev.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.mytdev.application.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ServiceDescriptor {

    private String name;
    private Class<? extends ServiceProvider<?>> provider;
    private Class<?> serviceType;
    private boolean cacheable;
    private boolean toLoadOnStartUp;
    private Map<String, Object> properties;
    private List<String> dependencies;

    public ServiceDescriptor(String name, Class<? extends ServiceProvider<?>> provider, Class<?> serviceType, boolean cacheable, boolean toLoadOnStartUp, Map<String, Object> properties, List<String> dependencies) {
        this.name = name;
        this.provider = provider;
        this.serviceType = serviceType;
        this.cacheable = cacheable;
        this.toLoadOnStartUp = toLoadOnStartUp;
        this.properties = properties;
        this.dependencies = dependencies;
    }

    public String getName() {
        return name;
    }

    public Object getProperty(String name) {
        return properties.get(name);
    }

    public Map<String, Object> getProperties() {
        return new HashMap<String, Object>(properties);
    }

    public Class<? extends ServiceProvider<?>> getProvider() {
        return provider;
    }

    public Class<?> getServiceType() {
        return serviceType;
    }

    public List<String> getDependencies() {
        return new ArrayList<String>(dependencies);
    }

    public boolean isCacheable() {
        return cacheable;
    }

    public boolean isToLoadOnStartUp() {
        return toLoadOnStartUp;
    }

}
